#pragma once

#include "ethernet_context.hpp"
#include "ethernet_frame.hpp"
#include "limbo/details/traits.hpp"

namespace limbo::ethernet {

template <typename NextState, int options = 0> struct State {
  using Context = EthernetContext<State>;
  using Packet = EthernetFrame<State>;
  using LowerState = NextState;
  using LowerPacket = details::lower_packet_t<LowerState>;
  static constexpr int opts = options;

  Result recv(Chunk buff, LowerState *lower_state) {
    return packet.recv(buff, *this, lower_state);
  }

  Packet &get_parsed() { return packet; }

  Packet packet;
};

} // namespace limbo::ethernet
